package com.czhong.rmi.server;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;

/**
 * Created by DELL on 2017/2/18.
 */
public class UserServer {
    public static void main(String[] as) throws RemoteException, NamingException {

        System.out.println("构造接口实现对象");
        UserImpl user = new UserImpl();

        System.out.println("注册接口实现到服务器");

        LocateRegistry.createRegistry(8888);


        Context namingContext = new InitialContext();
        namingContext.bind("rmi://localhost:8888/bind_user", user);

        System.out.println("等待客户端调用...");

    }
}
